class FriendsRankRenderer extends eui.ItemRenderer {
    private FriendsGroup:eui.Group;
    private head_pic:eui.Image;
    private rank_label:eui.Label;
    private Friends_name:eui.Label;
    private Growth_Length:eui.Label;//成长值
    private TipImg:eui.Image;//可浇水或者成长值；
    private SperatorBar:eui.Image;//分割条
    public constructor(){
        super();
        this.FriendsGroup=new eui.Group();
        this.head_pic=new eui.Image();
        this.rank_label=new eui.Label();
        this.Friends_name=new eui.Label();
        this.Growth_Length=new eui.Label();
    
        this.SperatorBar=new eui.Image();
      this.TipImg=new eui.Image();
        this.FriendsGroup.addChild(this.head_pic);
        this.FriendsGroup.addChild(this.Growth_Length);
        this.FriendsGroup.addChild(this.Friends_name);
        this.FriendsGroup.addChild(this.TipImg);
        this.FriendsGroup.addChild(this.SperatorBar);
        this.FriendsGroup.addChild(this.rank_label);
        this.addChild(this.FriendsGroup);
        this.FriendsGroup.addEventListener(egret.TouchEvent.TOUCH_TAP,this.Onclick,this);
    }
    protected dataChanged():void{
        //显示数据中的 label 值
        //this.Growth_Length.height=100;
        //this.Growth_Length.width=654;
        this.SperatorBar.x=100;
        this.SperatorBar.y=116;
        this.SperatorBar.source="resource/assets/FriendsWin/分隔线.png";
        this.Growth_Length.x=553;
        this.Growth_Length.y=24;
        this.Growth_Length.textColor=0x0c2f59;
        this.Growth_Length.size=24;
        this.Friends_name.x=170;
        this.Friends_name.y=50;
        this.Friends_name.fontFamily="PingFang SC";
        this.Friends_name.textColor=0x0f2540;
        this.Friends_name.size=24;
        this.rank_label.x=10;
        this.rank_label.y=40;
        this.rank_label.fontFamily="PingFang SC";
        this.rank_label.textColor=this.data.rankColor;
        this.head_pic.source="resource/assets/FriendsWin/小圆.png";
        this.head_pic.x=85;
        this.head_pic.y=27;
        this.rank_label.text=this.data.rank;
        this.Friends_name.text=this.data.name;
        this.Growth_Length.text=this.data.length;
         
        if(this.rank_label.text=="1"){
            this.TipImg.x=556;
            this.TipImg.y=72;
            this.TipImg.source="resource/assets/FriendsWin/成长值.png";
        }
        else{
            this.TipImg.x=540;
            this.TipImg.y=63;
            this.TipImg.source="resource/assets/FriendsWin/可浇水.png";
        }
    }
    private Onclick():void{
        SceneManager.instance.addScene(new FriendsHome());
    }
 
}